package com.shire.shire_interface.controller.quartz;

import com.shire.shire_interface.service.commandcenter.BaseCommandProcessor;
import com.shire.shire_interface.service.quartz.QuartzService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class QuartzController {
    private static Logger logger = LoggerFactory.getLogger(QuartzController.class);
    @Resource
    private QuartzService quartzService;

    @Resource
    private BaseCommandProcessor commandProcessor;

    /**
     * 每天12点5分执行
     */
    @Scheduled(cron = "0 05 0 * * ?")
    public void exeQuartz(){
        quartzService.exeQuartz();
    }

    @Scheduled(cron = "0 0 */2 * * *")
    public void syncAddress(){
        commandProcessor.sendSyncAddressToAll();
    }

    @Scheduled(cron = "0 */60 * * * *")
    public void checkCmdStatus(){
        commandProcessor.checkOverTimeCmd();
    }

//    @Scheduled(cron = "0 */5 * * * *")
//    public void retryCommands(){
//        commandProcessor.retryCommand();
//    }
}
